/**
 * File: AlternativeMatch.java
 * Created by: mhaimel
 * Created on: Nov 16, 2010
 * CVS:  $Id: AlternativeMatch.java 1.0 Nov 16, 2010 11:54:39 AM mhaimel Exp $
 */
package uk.ac.ebi.curtain.utils.match.sam;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReference;

import uk.ac.ebi.velvet.model.Strand;

/**
 * @author mhaimel
 *
 */
public class AlternativeMatch {
	
	// chr,pos,CIGAR,NM;
	private final String reference;
	private final AtomicInteger referenceLocation = new AtomicInteger(-1);
	private final AtomicInteger readLocation = new AtomicInteger(0);
	private final AtomicReference<Strand> readOrientation = new AtomicReference<Strand>();
	private final AtomicReference<Strand> alignOrientation = new AtomicReference<Strand>();
	private final AtomicBoolean repeatMarker = new AtomicBoolean(false);
	private final AtomicInteger alignLength = new AtomicInteger(0);
	private final AtomicIntegerArray qualities;
	
	public AlternativeMatch(String reference) {
		this(reference,new int[0]);
	}	
	
	public AlternativeMatch(String reference,int[] qualities) {
		super();
		this.reference = reference;
		this.qualities = new AtomicIntegerArray(qualities);
	}
	
	
	public void setRepeatMarker(boolean repeatMarker) {
		this.repeatMarker.set(repeatMarker);
	}
	
	public boolean getRepeatMarker() {
		return repeatMarker.get();
	}
	
	/**
	 * 
	 * @return the alignLength
	 */
	public int getAlignLength() {
		return alignLength.get();
	}
	
	public void setAlignLength(Integer alignLength) {
		this.alignLength.set(alignLength);
	}
	
	/**
	 * @return the readLocation
	 */
	public int getReadLocation() {
		return readLocation.get();
	}
	
	public void setReadLocation(Integer readLocation) {
		this.readLocation.set(readLocation);
	}	
	
	public String getReference() {
		return reference;
	}
	
	/**
	 * @return the readOrientation
	 */
	public Strand getReadOrientation() {
		return readOrientation.get();
	}
	
	public void setReadOrientation(Strand readOrientation) {
		this.readOrientation.set(readOrientation);
	}

	/**
	 * @return the alignOrientation
	 */
	public Strand getAlignOrientation() {
		return alignOrientation.get();
	}
	
	public void setAlignOrientation(Strand alignOrientation) {
		this.alignOrientation.set(alignOrientation);
	}
	
	/**
	 * @return the referenceLocation
	 */
	public int getReferenceLocation() {
		return referenceLocation.get();
	}
	
	public void setReferenceLocation(Integer referenceLocation) {
		this.referenceLocation.set(referenceLocation);
	}	
	
	
	public int getQualitiesLength(){
		return qualities.length();
	}

	/**
	 * @return the qualities
	 */
	public int getQualities(int i) {
		return qualities.get(i);
	}
}
